package unit5.part13;

public class ListManager {
    public static void main(String[] args) {
        List listA = new ArrayList();
        listA.add("A");
        System.out.println(listA.size());
        List listB = new ArrayList();
        listB.add("B");
        System.out.println(listA.compareTo(listB));
        
    }
}

interface List {
    void add(String str);

    int size();

    int compareTo(List list);
}

abstract class AbstractList implements List {
    @Override
    public int compareTo(List list) {
        return size() - list.size();
    }
}

class ArrayList extends AbstractList {
    int num = 0;

    @Override
    public void add(String str) {
        num++;
    }

    @Override
    public int size() {
        return num;
    }
}

